package com.eastjet.maintenance.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.eastjet.maintenance.domain.Annex;
import com.eastjet.maintenance.mapper.AnnexMapper;
import com.eastjet.maintenance.service.AnnexService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 杨博文
 * @description 针对表【annex(随附附件表)】的数据库操作Service实现
 * @createDate 2024-11-25 09:23:37
 */
@Service
public class AnnexServiceImpl extends ServiceImpl<AnnexMapper, Annex> implements AnnexService {

    /**
     * 新增附件
     *
     * @param an
     * @return
     */
    @Override
    public Boolean InsertAnnex(List<Annex> an) {
        return this.saveBatch(an);
    }

    /**
     * 修改附件
     *
     * @param an
     * @return
     */
    @Override
    public Boolean UpdateAnnex(Annex an) {
        return this.updateById(an);
    }

    /**
     * 删除附件
     *
     * @param code
     * @return
     */
    @Override
    public Boolean DeleteAnnex(List<String> code) {
        return this.removeByIds(code);
    }

    /**
     * 查询附件
     *
     * @param mainId
     * @return
     */
    public List<Annex> selectByMainId(String mainId) {
        return this.list(new QueryWrapper<Annex>().eq("code",mainId));
    }


}




